<template>
	<view class="diy">
		<block v-for="(item,index) in diyItems" :key="index">
			<!-- 搜索框-->
			<block v-if="item.type === 'search'">
				<diySearch :itemIndex="index" :itemStyle="item.style" :params="item.params"></diySearch>
			</block>
			<!-- banner轮播 -->
			<block v-if="item.type === 'banner'">
				<diyBanner :itemIndex="index" :itemStyle="item.style" :params="item.params" :dataList="item.data">
				</diyBanner>
			</block>
			<!-- 单图组 -->
			<block v-if="item.type === 'imageSingle'">
				<diyImageSingle :itemIndex="index" :itemStyle="item.style" :dataList="item.data"></diyImageSingle>
			</block>
			<!-- 视频组 -->
			<block v-if="item.type === 'video'">
				<diyVideo :itemIndex="index" :itemStyle="item.style" :params="item.params"></diyVideo>
			</block>
			<!-- 公告组 -->
			<block v-if="item.type === 'notice'">
				<diyNotice :itemIndex="index " :itemStyle="item.style" :params="item.params"></diyNotice>
			</block>
			<!-- 空白组 -->
			<block v-if="item.type === 'blank'">
				<diyBlank :itemIndex="index" :itemStyle="item.style"></diyBlank>
			</block>
			<!-- 辅助线 -->
			<block v-if="item.type === 'guide'">
				<diyGuide :itemIndex="index" :itemStyle="item.style"></diyGuide>
			</block>
			<!-- 导航组 -->
			<block v-if="item.type === 'navBar'">
				<diyNavBar :itemIndex="index" :itemStyle="item.style" :dataList="item.data"></diyNavBar>
			</block>
			<!-- 图片橱窗 -->
			<block v-if="item.type === 'window'">
				<diyWindow :itemIndex="index" :itemStyle="item.style" :dataList="item.data"></diyWindow>
			</block>
			<!-- 商品组 -->
			<block v-if="item.type === 'goods'">
				<diyGoods :itemIndex="index" :itemStyle="item.style" :dataList="item.data"></diyGoods>
			</block>
			<!-- 商品瀑布流 -->
			<block v-if="item.type === 'goodsWaterfall'">
				<diyGoods :itemIndex="index" :itemStyle="item.style" :dataList="item.data"></diyGoods>
			</block>
			<!-- 富文本 -->
			<block v-if="item.type === 'richText'">
				<view class="diyHtml"
					:style="{background:item.style.background,padding:item.style.paddingTop + 'px ' + item.style.paddingLeft + 'px'}">
					<my-parse :content="item.params.content"></my-parse>
				</view>
			</block>
			<!-- 在线客服 -->
			<block v-if="item.type === 'service'">
				<diyService :itemIndex="index" :itemStyle="item.style" :params="item.params"></diyService>
			</block>

		</block>
	</view>
</template>

<script>
	export default {
		name: "diy",

		props: {
			diyItems: Object
		},
		data() {
			return {

			};
		},
		created() {
		
		}
	}
</script>

<style lang="scss" scoped>
	.diyHtml {
		box-sizing: border-box;

		image {
			max-width: 100vw;

		}

		img {
			max-width: 100vw;
		}
	}
</style>
